import { defineStore } from 'pinia';
import { Session } from '@/assets/utils/storage';

export const storeKey = 'errorReqKey';

/**
 * 保存异常请求
 */
export const useErrorReqStore = defineStore('errorReqStore', {
  state: () => ({
    requests: <any>[]
  }),
  actions: {
    async setErrorReq(request: any) {
      this.requests.unshift(request);
      Session.set(storeKey, this.requests)
    }
  }
});